#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QMutex>
#include "v4l2.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();


private slots:
    void captureAndDisplayFrame();
    void snapshot();
    void startRecording();
    void stopRecording();
    void startStreaming();
    void stopStreaming();

private:
    void updateButtonStates();

    Ui::MainWindow *ui;
    QTimer *timer;
    QMutex mutex;
    V4L2Context v4l2_ctx;
    bool isRecording = false;
    bool isStreaming = false;
    int frameCount = 0;
};
#endif // MAINWINDOW_H
